#ifndef __SCULL_H_
#define __SCULL_H_

#include <linux/semaphore.h>
#include <linux/cdev.h>

#define LDD_DEBUG

#undef PDEBUG
#ifdef LDD_DEBUG
    #ifdef __KERNEL__
        #define PDEBUG(fmt, args...) printk( KERN_ALERT "scull: [%s:%d] " \
                fmt "\n", __FUNCTION__, __LINE__, ## args)
    #else
        #define PDEBUG(fmt, args...) fprintf(stderr, "[%s:%d] " \
                fmt "\n", __FUNCTION__, __LINE__, ## args)
    #endif
#else
    #define PDEBUG(fmt, args...)
#endif

#define SCULL_MAJOR 0
#define SCULL_MINOR 0
#define SCULL_NR_DEVS 4
#define SCULL_QUANTUM 4000
#define SCULL_QSET 1000

struct scull_qset {
    void **data;
    struct scull_qset *next;
};

struct scull_dev {
    struct scull_qset *data;
    int quantum;
    int qset;
    unsigned long size;
    unsigned int access_key;
    struct semaphore sem;
    struct cdev cdev;
};

/*
 * Prototypes for shared funcitions 
 */
int scull_open(struct inode *inode, struct file *filp);
int scull_release(struct inode *node, struct file *filp);
ssize_t scull_read(struct file *filp, char * __user buf, size_t count,loff_t *f_pos);
ssize_t scull_write(struct file *filp, const char * __user buf, size_t count, loff_t *f_pos);
int scull_ioctl(struct inode *inode, struct file *filp, unsigned int cmd, 
                unsigned long arg);
loff_t scull_llseek(struct file *filp, loff_t off, int where);


#endif

